/*    */ package com.zimbra.cs.service.formatter;
/*    */ 
/*    */ import com.zimbra.common.util.tar.TarEntry;
/*    */ import com.zimbra.common.util.tar.TarInputStream;
/*    */ import java.io.IOException;
/*    */ import java.io.InputStream;
/*    */ import java.util.Date;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class TarArchiveInputStream
/*    */   implements ArchiveFormatter.ArchiveInputStream
/*    */ {
/*    */   private TarInputStream is;
/*    */   
/*    */   public class TarArchiveInputEntry
/*    */     implements ArchiveFormatter.ArchiveInputEntry
/*    */   {
/*    */     private TarEntry entry;
/*    */     
/*    */     public TarArchiveInputEntry(TarInputStream is)
/*    */       throws IOException
/*    */     {
/* 32 */       this.entry = is.getNextEntry();
/*    */     }
/*    */     
/* 35 */     public long getModTime() { return this.entry.getModTime().getTime(); }
/*    */     
/* 37 */     public String getName() { return this.entry.getName(); }
/*    */     
/* 39 */     public long getSize() { return this.entry.getSize(); }
/*    */     
/* 41 */     public int getType() { return this.entry.getMajorDeviceId(); }
/*    */     
/* 43 */     public boolean isUnread() { return (this.entry.getMode() & 0x80) == 0; }
/*    */   }
/*    */   
/*    */ 
/*    */   public TarArchiveInputStream(InputStream is, String cset)
/*    */   {
/* 49 */     this.is = new TarInputStream(is, cset);
/*    */   }
/*    */   
/*    */ 
/* 53 */   public void close() throws IOException { this.is.close(); }
/*    */   
/* 55 */   public InputStream getInputStream() { return this.is; }
/*    */   
/*    */   public ArchiveFormatter.ArchiveInputEntry getNextEntry() throws IOException {
/* 58 */     TarArchiveInputEntry taie = new TarArchiveInputEntry(this.is);
/*    */     
/* 60 */     return taie.entry == null ? null : taie;
/*    */   }
/*    */   
/*    */   public int read(byte[] buf, int offset, int len) throws IOException {
/* 64 */     return this.is.read(buf, offset, len);
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/formatter/TarArchiveInputStream.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */